﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtomPuzzleSolver.Model
{
    public static class Utilities
    {
        public static int IsOdd(int n)
        {
            return Convert.ToInt32(IsOddBool(n));
        }
        public static int IsEven(int n)
        {
            return Convert.ToInt32(!IsOddBool(n));
        }
        private static bool IsOddBool(int n)
        {
            return Convert.ToBoolean(Math.Abs(n) & 1);
        }

        public static bool IsInBound(this HexagonalCell[,] array, int x, int y)
        {
            int lowerBound0 = array.GetLowerBound(0) - 1;
            int lowerBound1 = array.GetLowerBound(1) - 1;
            int upperBound0 = array.GetUpperBound(0) + 1;
            int upperBound1 = array.GetUpperBound(1) + 1;

            if (x > lowerBound0 && y > lowerBound1 && x < upperBound0 && y < upperBound1)
            {
                return true;
            }
            return false;
        }


    }
}
